<?php
/*! \page license
 *
 * Copyright (c) 2011, Blaise Lengrand
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list
 * of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this
 * list of conditions and the following disclaimer in the documentation and/or
 * other materials provided with the distribution.
 * Neither the name of `snWin' nor the names of its contributors may be used to
 * endorse or promote products derived from this software without specific prior
 * written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
  session_start();
  // Set the debug flag
  if (isset($_GET['debug']))
    $_SESSION['debug'] = true;
  if (isset($_GET['nodebug']))
    unset($_SESSION['debug']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="content-language" content="en" />
    <title>snWin | Dev</title>
    <link href="http://www.snwin.com/favicon.ico" rel="shortcut icon" />
    <link type="text/css" href="system/pages/social/skin/default/style.css" rel="stylesheet" />
    <!-- Javascript source //-->
    <script type="text/javascript" src="http://www.snwin.com/system/pages/social/core_js.php"></script>
<?php
  if ($_SESSION['debug'])
    echo "<script type=\"text/javascript\" src=\"http://www.snwin.com/system/pages/social/feed_log.js\"></script>\n";
?>
    <!-- Modules //-->
<?php
    define("MODULES_PATH", "system/pages/social");
    // Automatically add modules
    $h = opendir(MODULES_PATH."/");
    while ($name = readdir($h))
    {
      if ($name == "." || $name == ".." || !is_dir(MODULES_PATH."/".$name))
        continue;
      // Includes the javascript file if any
      if (is_file(MODULES_PATH."/".$name."/".$name.".js"))
        echo "<script type=\"text/javascript\" src=\"".MODULES_PATH."/".$name."/".$name.".js\"></script>\n";
      // Includes the php file if any
      if (is_file(MODULES_PATH."/".$name."/".$name.".php"))
        include(MODULES_PATH."/".$name."/".$name.".php");
    }
?>
  </head>
  <body>
    <div id="container">
      <div id="header"></div>
      <div id="navigation"></div>
      <div id="content"><div id="id_social" class="social">
<?php
  if ($_SESSION['debug'])
    echo "<div id=\"id_social_log\" class=\"social_log\"></div>\n";
?>
  <div class="social_header">
    <div class="social_actions"><a href="javascript:feed_add();">Add a new feed</a> - <a href="javascript:feed_all_entry_read();">Mark all as read</a> - <a href="javascript:feed_show_all();">Show all</a> - <a class="social_actions_unread" href="javascript:feed_unread_toggle();">Show unread</a></div>
    <div id="id_social_postarea" class="social_postarea"></div>
    <div class="social_message"></div>
    <div id="id_social_group" class="social_group"></div>
    <div id="id_social_network" class="social_network"></div>
    <br style="clear: both;" />
  </div>
<div id="id_social_feed" class="social_feed">
  <div id="id_entry_head"></div>
</div>
<hr />
Snwin © 2011 - Standalone version - <a href="javascript:session_clear(SESSION_TYPE_LOCAL);">Delete local session</a> - <a href="javascript:feed_previous();">More updates</a> - <a href="?<?php echo (isset($_SESSION['debug']))?'nodebug':'debug'; ?>">Switch to debug/nodebug</a></div>

<script type="text/javascript">
<!--
<?php
  if (isset($_SESSION['debug']))
    echo "var debug = true;";
?>

  function do_not_store_local_data()
  {
    session_disable(SESSION_TYPE_LOCAL);
    feed_prompt_close();
  }

  $(window).load(function() {
    session_init();
    feed_log_init();
    feed_core_init(<?php echo time(); ?>);
    session_load();
  });
//-->
</script>

</div>
      <div id="extra"></div>
      <div id="footer"></div>
</div>
  </body>
</html>
